import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import NotFound from '@/views/404'
import Login from '@/views/login'
import Home from '@/views/home'
import Main from '@/views/main'
import ETable from '@/views/nav1/table'
import EForm from '@/views/nav1/form'
import EList from '@/views/nav1/list'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/test',
      name: 'HelloWorld',
      component: HelloWorld,
      hidden: true
    },
    {
      path: '/',
      name: 'Login',
      component: Login,
      hidden: true,
      redirect: {path: '/login'}
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
      hidden: true
    },
    {
      path: '/404',
      name: 'NotFound',
      component: NotFound,
      hidden: true
    },
    {
      path: '*',
      name: 'NotFound',
      component: NotFound,
      hidden: true,
      // 设置重定向，必须有可转向的路由
      redirect: {path: '/404'}
    },
    {
      path: '/home',
      name: 'Main',
      component: Home,
      children: [
        {path: '/main', component: Main, hidden: true}
      ]
    },
    {
      path: '/home',
      component: Home,
      name: 'nav1',
      iconCls: 'el-icon-message',
      children: [
          // { path: '/main', component: Main, name: '主页', hidden: true },
          { path: '/table', component: ETable, name: 'Table' },
          { path: '/form', component: EForm, name: 'Form' },
          { path: '/list', component: EList, name: '列表' }
      ]
    }
  ]
})
